#include "stdafx.h"
#include "SignInReward.h"
#include "InstanceTouch.h"

DECL_INSTANCE_TOUCH(ETouch_SignInReward);

struct  SignInRewardReflectionRegister
{
	SignInRewardReflectionRegister()
	{
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iID,INVALID_ID).Editor_SetAsPrimaryKey();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_sDisplayName,std::string("DefaultName")).Editor_SetAsDisplayName();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iDayNum,uint32(20)).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType1,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID1,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType2,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID2,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType3,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID3,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType4,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID4,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType5,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID5,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType6,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID6,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType7,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID7,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType8,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID8,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType9,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID9,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType10,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID10,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType11,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID11,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType12,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID12,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType13,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID13,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType14,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID14,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType15,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID15,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType16,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID16,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType17,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID17,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType18,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID18,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType19,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID19,0).Editor_SetAsRaw();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_eRewardType20,eERewardItemType_NONE).Editor_SetAsEnumation<ERewardItemType>();
		REGISTER_REFLECTION_MEMBER(SignInReward,m_iNumOrID20,0).Editor_SetAsRaw();

		GlobalClassManager::Instance().RegisterClass(SignInReward::s_GetReflection(),eDefaultDef_SignInReward);
		GlobalDefManager::Instance().RegisterDefManger(&SignInRewardManager::Instance());

	}
}___signinrewardreflectionregister;

rewrite  void SignInReward::OnArchieveReaded()
{
	m_vRewardTypes.clear();
	m_vRewardNumOrIDs.clear();
	if(m_iDayNum>20) m_iDayNum=20;

	m_vRewardTypes.push_back(eERewardItemType_NONE);
	m_vRewardNumOrIDs.push_back(0);
	
	for(uint32 ii=1;ii<=m_iDayNum;ii++)
	{
		{
			std::stringstream ss;
			ss<<"m_eRewardType"<<ii;
			const CMember* pMember=GetReflection().LookupMember(ss.str());
			m_vRewardTypes.push_back(* pMember->GetMemberData<ERewardItemType>(this));
		}
		{
			std::stringstream ss;
			ss<<"m_iNumOrID"<<ii;
			const CMember* pMember=GetReflection().LookupMember(ss.str());
			m_vRewardNumOrIDs.push_back(* pMember->GetMemberData<int32>(this));
		}
	}

}

std::pair<ERewardItemType,int32> SignInReward::GetRewardOfDay( uint32 iDay ) const
{
	if(iDay<=m_iDayNum)
	{
		return std::make_pair(m_vRewardTypes[iDay],m_vRewardNumOrIDs[iDay]);
	}
	return std::make_pair(eERewardItemType_NONE,0);
}